package com.jusfoun.communication.model;


import java.io.Serializable;
import java.util.Date;
import java.util.List;

import static com.jusfoun.communication.constant.MessageConstant.*;


/**
 * 消息类
 *
 * @author player six
 * @email jslcylcy@163.com
 * @create 2017-10-12 17:25
 **/
public class Message implements Serializable {

    private String token;

    private String appId;

    private String appSecret;

    private String text;

    private String from;

    private String to;

    private List<File> fileList;

    /**
     * 消息类型，默认 text(普通文本消息),image 图片,file 文件,video 视频,audio 音频
     */
    private String type = FILE_TYPE;

    private long id;

    private int status = STATUS_NOT_SEND;

    // code:100 普通消息  400:重复登录被踢出
    private int code;

    private Date time;

    public Message() {
        super();
    }

    public Message(int code) {
        this.code = code;
        this.time = new Date();
    }

    public Message(String text, int code) {
        this.text = text;
        this.code = code;
        this.time = new Date();
    }

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public String getAppSecret() {
        return appSecret;
    }

    public void setAppSecret(String appSecret) {
        this.appSecret = appSecret;
    }

    public String getText() {
        return text;
    }

    public void setText(String text) {
        this.text = text;
    }

    public String getFrom() {
        return from;
    }

    public void setFrom(String from) {
        this.from = from;
    }

    public String getTo() {
        return to;
    }

    public void setTo(String to) {
        this.to = to;
    }

    public Date getTime() {
        return time;
    }

    public void setTime(Date time) {
        this.time = time;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getAppId() {
        return appId;
    }

    public void setAppId(String appId) {
        this.appId = appId;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getToken() {
        return token;
    }

    public void setToken(String token) {
        this.token = token;
    }

    public List<File> getFileList() {
        return fileList;
    }

    public void setFileList(List<File> fileList) {
        this.fileList = fileList;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public static class File implements Serializable {
        private String serverUrl;

        private String originalFileName;

        public File(String serverUrl, String originalFileName) {
            this.serverUrl = serverUrl;
            this.originalFileName = originalFileName;
        }

        public String getServerUrl() {
            return serverUrl;
        }

        public void setServerUrl(String serverUrl) {
            this.serverUrl = serverUrl;
        }

        public String getOriginalFileName() {
            return originalFileName;
        }

        public void setOriginalFileName(String originalFileName) {
            this.originalFileName = originalFileName;
        }
    }
}
